<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%-- 
    Document   : estoque
    Created on : May 19, 2014, 3:48:43 PM
    Author     : root
    Pagina: pagina 7
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Estoque</title>
        <style>
            table{
                margin-right: auto;
                margin-left: auto;
            }
            h1{
            text-align: center;
            }
        </style>
    </head>
    <body>
        <h1>Produtos Disponíveis</h1>
        <jsp:useBean id="productsList" type="java.util.ArrayList" scope="session"/>
        
        <table border="1">
            <tr><th>Nome</th><th>Categoria</th><th>Valor</th><th>Qtd. Estoque</th><th>Status</th><th>Editar</th></tr>
            <c:forEach var="pro" items="${productsList}">
                <tr>
                    <td>${pro.nome}</td>
                    <td>${pro.categoria}</td>
                    <td>${pro.valor}</td>
                    <td>${pro.qtdEmEstoque}</td>
                    <c:choose>
                        <c:when test="${pro.status == true}">
                            <td>Disponível</td>
                        </c:when>
                        <c:otherwise>
                            <td>Finalizado</td>
                        </c:otherwise>
                    </c:choose>

                    <td><a href="../ServletAdmProduto?acao=editarProduto&prodId=${pro.id}">Editar</a></td>
                </tr>
            </c:forEach>
        </table>
        
        <p align="center"><a href="../home.jsp">Voltar</a></p>
        
    </body>
</html>
